import axios from 'axios';
// import { message, Button, Space } from 'antd';

const intance = axios.create({
  baseURL: 'http://localhost:7001/',
  timeout: 50000
})

intance.interceptors.request.use((config) => {
  // 统一处理携带token
  config.headers.authorization = localStorage.getItem('token');
  return config;
}, (err) => {
  return Promise.reject(err)
})

intance.interceptors.response.use((response) => {
  console.log(response, 'respinse')
  if (response.data.errno == 0) {
    return response.data
  } else {
    message.error(response.data.msg);
  }

}, (err) => {
  return Promise.reject(err)
})

export default intance;
